#pragma once

#include "CoreMinimal.h"
#include "ReplicationGraph.h"
#include "Define/LevelLineComponentCollection.h"
#include "Define/LineComponentContainer.h"
#include "Define/SpatialCoordinate.h"
#include "LRG_Node_ComponentBuckets.generated.h"

class ULineReplicationGraphComponent;

UCLASS()
class LINEREPLICATIONGRAPH_API ULRG_Node_ComponentBuckets : public UReplicationGraphNode
{
	GENERATED_BODY()

public:
	struct FSettings
	{
		int32 NumBuckets = 3;
		bool EnableFastPath = false; // Whether to return lists as FastPath in "off frames". Defaults to false.
		int32 FastPathFrameModulo = 1; // Only do fast path if frame num % this = 0
	};
	ULRG_Node_ComponentBuckets();
public:
	void AddNetworkActor(ULineReplicationGraphComponent* Component);
	bool RemoveNetworkActor(ULineReplicationGraphComponent* Component);
	void ResetAllNetworkActors();
	virtual void GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) override;
protected:
	void SetNonStreamingCollectionSize(int32 NewSize);
protected:
	UPROPERTY()
	TArray<FLineComponentContainer> NonStreamingComponentCollection;

	//这是没有额外添加Streaming的管理器,如果需要支持StreamingLevel相关的逻辑,只需要将StreamingLevel作为一条额外的线就可以了
	UPROPERTY()
	FLevelLineComponentCollection LevelStreamingComponentCollection;

	FSettings Settings;

	FActorRepListRefView ListForGather;
};